package com.oktest.measure.media.video

import android.os.Bundle
import android.view.View
import android.widget.MediaController
import androidx.appcompat.app.AppCompatActivity
import com.oktest.measure.R
import kotlinx.android.synthetic.main.activity_video_play.*

/**
 * @Author hhh
 * @Date 2020/10/27
 */
class VideoPlayActivity: AppCompatActivity() {

    companion object{
        const val FILE_PATH = "file_path"
    }

    private val mediaController by lazy {
        MediaController(this)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_video_play)
        val filePath = intent.getStringExtra(FILE_PATH)
        videoView.visibility = View.VISIBLE
        videoView.requestFocus()
        videoView.setMediaController(mediaController)
        mediaController.setMediaPlayer(videoView)
        videoView.setVideoPath(filePath)
        videoView.start()
    }
}